package controlLayer;

import java.util.ArrayList;
import java.util.List;

import modelLayer.Staff;
import dbLayer.DBStaff;

public class StaffCtrl {
	
	private DBStaff dbStaff = new DBStaff();
	
	public StaffCtrl () {
		
	}
	
	public Staff findSingleStaffName (String staffName) {
		
		Staff staff = null;
		
		List<Staff> resultStaff = new ArrayList<>();
		
		resultStaff = dbStaff.findStaffName(staffName);
		
		if (resultStaff.size() > 1) {
			System.out.println("More than one staff member with that name!");
		}
		else if (resultStaff.size() == 1) {
			staff = resultStaff.get(0);
		}
		else {
			System.out.println("No staff member with that name!");
		}
		
		return staff;
		
	}
	
	public Staff findStaffID (int staffID) {
		
		Staff staff = null;
		
		staff = dbStaff.findStaffID(staffID);
		
		return staff;
		
	}

	public void addStaff(Staff staff) {
		
		dbStaff.addStaff(staff);
		
	}

	public List<Staff> allStaff() {
		
		return dbStaff.allStaff();
		
	}

	public int highestID() {
		
		return dbStaff.highestID();
		
	}

	public void updateStaff(Staff staff) {
		
		dbStaff.updateStaff(staff);
		
	}

	public void removeStaff(int staffID) {
		
		dbStaff.removeStaff(staffID);
		
	}

}
